package com.yfp.operation.mapper;

import com.yfp.operation.domain.PositionSharing;
import com.yfp.operation.domain.UserBill;
import com.yfp.operation.domain.dto.SubAccountDTO;
import com.yfp.operation.domain.vo.SharingVO;
import com.yfp.operation.domain.vo.SubAccountVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.hsqldb.rights.User;

import java.util.List;
import java.util.Set;

/**
 * @Description: 用户分成账单
 * 
 * @CreateDate: 2024/5/28 14:17
 * @UpdateUser: 
 * @UpdateDate: 2024/5/28 14:17
 * @UpdateRemark: 暂无修改
 * @Version: 1.0
 */
@Mapper
public interface UserBillMapper {
    UserBill findById(Long id);
    /**
     * 查询账单
     *
     * @param userId
     * @return
     */
    List<UserBill> getByUserId(@Param("userId") Long userId);

    /**
     * 查询订单分账单
     *
     * @param userId
     * @return
     */
    List<UserBill> findByOrderSn(@Param("orderSn") String orderSn);

    /**
     * 新增账单
     *
     * @param userBill
     */
    void add(UserBill userBill);

    /**
     * 修改账单
     *
     * @param userBill
     */
    void edit(UserBill userBill);


    /**
     * 修改状态
     *
     * @param ids
     * @param status
     */
    void editStatusInIds(@Param("ids") List<Long> ids, @Param("status") Integer status);

    /**
     * 根据用户查询未入账单
     *
     * @param userId
     * @param status
     * @return
     */
    List<UserBill> findByUserIdAndStatus(@Param("userId") Long userId, @Param("status") Integer status);

    /**
     * 查询账单
     *
     * @param status
     * @param day
     * @return
     */
    List<UserBill> findByStatusAndCreateTime(@Param("status") Integer status, @Param("day") Integer day);

    /**
     * 查询解冻账单
     * @return
     */
    List<UserBill> findUnfreeze();

    List<UserBill> statisticsFreezeMoney(@Param("status") Integer status,@Param("machineIds") List<String> machineIds);

    List<SubAccountVO> subAccount(SubAccountDTO subAccountDTO);

    List<UserBill> selectAllUserBill(SubAccountDTO subAccountDTO);

    List<SharingVO> selectSharing(@Param("userIds") List<Integer> userIds);


    List<UserBill> getByOrderSnAndStatusNot(@Param("orderSn")String orderSn, @Param("status")Integer status);

    List<UserBill> getByOrderSnAndStatus(@Param("orderSn")String orderSn, @Param("status")Integer status);

    List<UserBill> getByIdsIn(@Param("ids") List<Long> ids);

    List<SubAccountVO> getByMachineIdAccount(SubAccountDTO subAccountDTO);

    List<UserBill> selectByMachineIdUserBill(SubAccountDTO subAccountDTO);

    List<String> getMachineId(SubAccountDTO subAccountDTO);

    List<UserBill> selectMachineSharing(SubAccountDTO subAccountDTO);

    List<PositionSharing> getSharing(@Param("orderIds") Set<String> orderIds);

    Double getBalance(@Param("userId") Long userId, @Param("status") Integer status);

    List<Integer> getUserId(String accountNumber);

    /**
     * 超时未申请打款
     * @return
     */
    List<UserBill> findOutTimeNotMakePayment();

    String findSysDictDate(String dictType);
}